﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DLTN.Entities;
using DLTN.Data;

public partial class Controls_ControlChuyenMucNoiBatContent : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HienThiChuyenMuc();
        }
    }

    private void HienThiChuyenMuc()
    {
        string strHTML = "";
        int TotalRows = 0;
        string WhereClause = "";
        TList<Tour> TList_Tour = DataRepository.TourProvider.GetPaged(WhereClause, "NEWID()", 0, 5, out TotalRows);
        if(TList_Tour.Count > 0)
        {
            int j = 1;

            //Phần liệt kê            
            for (int i = 0; i <= TList_Tour.Count-1; i++)
            {                
                strHTML += "<div id=\"li-content" + j + "\"><div style=\"float: left; margin-top: 5px; margin-bottom: 3px; width: 100%;\">";
                strHTML += "<div style=\"float: left; margin-left: 10px; margin-top: 4px; width: 6%;\"><img src=\"images/dltn/caydua.png\" border=\"0\"></div>";
                strHTML += "<div style=\"float: left; margin-left: 5px; margin-top: 7px; clear: right; width: 75%;\">";
                strHTML += "<div style=\"font-family: Tahoma; font-size: 12pt; color: #bb0009\"><a class=\"chuyenmucnoibat\" href='Tour/" + TList_Tour[i].Id + "/" + TList_Tour[i].IdSubTour + "/" + GetTieuDe(TList_Tour[i].TieuDe) + ".aspx'>" + TList_Tour[i].TieuDe.ToString() + "</a></div>";
                strHTML += "<div class=\"date-time\">" + Common.StandardStringjquery(TList_Tour[i].NgayCapNhat.ToString("'' dd/MM/yyyy, HH:mm 'GMT+7'")) + "</div></div></div>";
                strHTML += "<div class=\"MainItemImg\">";
                strHTML += "<a href='Tour/" + TList_Tour[i].Id + "/" + TList_Tour[i].IdSubTour + "/" + GetTieuDe(TList_Tour[i].TieuDe) + ".aspx'>" + "<img class=\"radius\" alt='" + TList_Tour[i].TieuDe + "' src=\"upload/TourBig/" + TList_Tour[i].AnhDaiDien + "\" border=\"0\"></a></div>";
                strHTML += "<div class=\"MainItemText\">" + TList_Tour[i].TomTat + "</div>";
                strHTML += "<div style=\"margin-top: 5px; padding-left: 529px\">";
                strHTML += "<div class=\"seemoreDiv\"><a href='Tour/" + TList_Tour[i].Id + "/" + TList_Tour[i].IdSubTour + "/" + GetTieuDe(TList_Tour[i].TieuDe) + ".aspx' class=\"seemoreText\">";
                strHTML += "<div style=\"padding-top: 2px; padding-left: 2px\">Xem tiếp</div></a></div></div></div>";                
                j++;
            }
        }

        litchuyenmuc.Text = strHTML;
    }

    public string GetTieuDe(object Char)
    {
        string s = Char.ToString();
        return Common.ConvertToUnSign(s);
    }

}